package cn.jhc.Adapter;

import java.util.List;

import cn.jhc.bean.ReceiptHelpInfo;

import com.example.shilehui.R;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PersonDetailInfoAdapter extends BaseAdapter {
	
	private Context _context;
	private ViewHolder _holder;
	private List<String> _titleList;
	private List<String> _contentList;
	
	public PersonDetailInfoAdapter(Context context,List<String> contentList,List<String> titleList){
		_context=context;
		_contentList=contentList;
		_titleList=titleList;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return _titleList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		
		if(convertView==null){
			LayoutInflater inflater = (LayoutInflater)_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView=inflater.inflate(R.layout.person_detail_info__layout, null);
			_holder=new ViewHolder();
			_holder.titleTextView=(TextView)convertView.findViewById(R.id.peroson_detail_title);
			_holder.contentTextView=(TextView)convertView.findViewById(R.id.person_detail_content);
			
			
			/*convertView.setBackground(_context.getResources().getDrawable(R.drawable.title_logo));*/
			convertView.setTag(_holder);
		}else{
			_holder=(ViewHolder)convertView.getTag();
		}
		_holder.titleTextView.setText(_titleList.get(position));
		_holder.titleTextView.setTextColor(Color.BLACK);
		_holder.titleTextView.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
		_holder.titleTextView.setTextSize(20);
		_holder.titleTextView.setPadding(20, 0, 0, 0);
		_holder.contentTextView.setText(_contentList.get(position));
		_holder.contentTextView.setTextColor(Color.BLACK);
		_holder.contentTextView.setGravity(Gravity.RIGHT);
		_holder.contentTextView.setTextSize(20);
		_holder.contentTextView.setPadding(20, 0, 20, 0);
		
		return convertView;
	}
	
	private class ViewHolder{
		TextView titleTextView;
		TextView contentTextView;
	}
}
